{% load static %}
{#{#内容列表项目#}
<nav class="" style="height: 58px;color: #121212;font-size: 15px;display: flex;border-bottom: 1px solid #f0f2f7;">
    <div class="nav-link" style="display: flex;align-items: flex-start; ">
        <span><a class="" href="{% url 'index' %}">首页</a>>>{{ parent_Category_name }}>></span><a href="javascript:location.reload();" style="">{{ Category_name }}</a>
    </div>
</nav>
<div class="list-group ">
    {% for item in querySet %}
        <div class="search-card" id="item{{ item.id }}">
            <h2>
                <div class="searchContentTitleLine">
                    <a href="{% url "media" item.file %}"
                       style="color: red;text-decoration: none;">{{ item }}</a> <a type="button" href="{% url "media" item.file %}"
                       style="color: blue;text-decoration: none;" download="">下载</a></div>
            </h2>
            <div class="searchContent">
                {{ item.content|safe|truncatechars_html:80 }}
            </div>
            <div style="padding: 10px 20px;    margin: 0 -20px -10px">
                {#按钮 阅读量#}
                {#                <button type="button" class="btn border-0"#}
                {#                        style="background-color: rgba(0,102,255,.15);color: #06f;font-size: 14px;">#}
                {#                    <span style="display: inline-flex; align-items: center;"><svg#}
                {#                            class="Zi Zi--TriangleUp VoteButton-TriangleUp" fill="currentColor" viewBox="0 0 24 24"#}
                {#                            width="10" height="10"><path#}
                {#                            d="M2 18.242c0-.326.088-.532.237-.896l7.98-13.203C10.572 3.57 11.086 3 12 3c.915 0 1.429.571 1.784 1.143l7.98 13.203c.15.364.236.57.236.896 0 1.386-.875 1.9-1.955 1.9H3.955c-1.08 0-1.955-.517-1.955-1.9z"#}
                {#                            fill-rule="evenodd"></path></svg></span>#}
                {#                    阅读量 {{ item.readNum }}#}
                {#                </button>#}
                {# 按钮 发布日期#}
                <button type="button" class="btn border-0"
                        style="background-color: rgba(0,102,255,.15);color: #06f;font-size: 14px;">
                    <span style="display: inline-flex; align-items: center;"><svg
                            class="Zi Zi--TriangleUp VoteButton-TriangleUp" fill="currentColor" viewBox="0 0 24 24"
                            width="10" height="10"><path
                            d="M2 18.242c0-.326.088-.532.237-.896l7.98-13.203C10.572 3.57 11.086 3 12 3c.915 0 1.429.571 1.784 1.143l7.98 13.203c.15.364.236.57.236.896 0 1.386-.875 1.9-1.955 1.9H3.955c-1.08 0-1.955-.517-1.955-1.9z"
                            fill-rule="evenodd"></path></svg></span>

                    发布日期:{{ item.date }}
                </button>
                <span style=" margin-left: 15px" id="delButton{{ item.id }}"><input type="button"
                                                                                    id="btnajax{{ item.id }}"
                                                                                    value="删除"/></span>


                {# 按钮 阅读全文#}
                {#                <button type="button" class="btn border-0"#}
                {#                        style="background-color: rgba(0,102,255,.15);color: #06f;font-size: 14px;">#}
                {#                    <a href="{% url "detail" item.pageid %}"#}
                {#                       style="color: inherit;text-decoration: none;">阅读全文</a>#}
                {#                </button>#}
            </div>


        </div>


        <script>
            $(function () {
                $('#btnajax{{ item.id }}').click(function () {
                    //请求参数
                    var list = {};
                    //
                    $.ajax({
                        type: "POST",
                        //请求的媒体类型
                        contentType: "application/json;charset=UTF-8",
                        //请求地址
                        url: "{% url 'delsaveUploadList' item.id%}",
                        //数据，json字符串
                        data: JSON.stringify(list),
                        //请求成功
                        success: function (result) {
                            console.log(result);
                            $("#item{{ item.id }}").remove();
                        },
                        //请求失败，包含具体的错误信息
                        error: function (e) {
                            console.log(e.status);
                            console.log(e.responseText);
                        }
                    });
                });
            })

        </script>


    {% endfor %}

</div>